<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>清除浮动练习</title>
    <style>
        /* 双伪元素清除浮动 */
        .clearfix:before,
        .clearfix:after {
            content: "";
            display: table;
        }

        .clearfix:after {
            clear: both;
        }

        .clearfix {
            *zoom: 1;
        }

        /* 伪元素清除浮动 */
        /*.clearfix:after {
            content: "";
            display: block;
            height: 0;
            clear: both;
            visibility: hidden;
        }

        .clearfix {
            *zoom: 1;
        }*/

        .top-one {
            margin: 30px auto 0;
            width: 400px;
            background-color: #e6f7ff;
            /*清除浮动：简单 无法显示溢出的部分*/
            /*overflow: hidden;*/
        }

        .one-a {
            width: 180px;
            height: 50px;
            background-color: #ffd77a;
            float: left;
        }

        .one-b {
            width: 180px;
            height: 80px;
            background-color: #ff6700;
            float: left;
        }

        /* 额外标签法（隔墙法），W3C推荐做法
          必须是块级元素、添加无意义标签*/
        /*.clear-float {
            clear: both;
        }*/

        .overlapping {
            margin: 30px auto 0;
            width: 420px;
            height: 30px;
            background-color: #18b566;
        }
    </style>
</head>
<body>

<div class="top-one clearfix">
    <div class="one-a">one</div>
    <div class="one-b">two</div>
    <div class="clear-float"></div>
</div>
<div class="overlapping"> test</div>
</body>
</html>